package lu.med.praxiswahl.wahlumed.client.menustructure;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultListModel;

import lu.med.praxiswahl.wahlumed.client.ordonancen.OrdonancenNewDialog;
import lu.med.praxiswahl.wahlumed.client.ordonancen.OrdonancenPanel;
import lu.med.praxiswahl.wahlumed.client.wclient.Main;


/**
 * 
 * @author Lars Holger Roth
 */
public class OrdonancenDialogActionListener implements ActionListener
{

    private Main dataManager;
    private OrdonancenPanel model;
    private int mode;
    private String keyword = "";

    public OrdonancenDialogActionListener(DefaultListModel list,
	    Main dataManager, OrdonancenPanel model, int mode, String keyword,
	    Long id)
    {

	this.dataManager = dataManager;
	this.model = model;
	this.mode = mode;
	this.keyword = keyword;

    }

    public void actionPerformed(ActionEvent e)
    {
	if ((model.getCurIndex() == -1)
		&& (mode == OrdonancenNewDialog.MODE_EDIT))
	    return;
	new OrdonancenNewDialog(dataManager, mode, model.getCurIndex(), model,
		keyword, model.getCurID());
    }

}
